<template>
  <div>
    <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
      <el-tab-pane label="清单" name="/main-list">
        <main-list v-if="selectTab == '清单'" />
      </el-tab-pane>
      <el-tab-pane label="待开发" name="/test-tab"
        ><sub-page-1 v-if="selectTab == '待开发'" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>


<script>
import MainList from "./MainList.vue";
import SubPage1 from "./SubPage1.vue";
import SubPage2 from "./SubPage2.vue";
import { mapActions } from "vuex";

export default {
  name: "mainPage",
  components: {
    MainList,
    SubPage1,
    SubPage2,
  },
  data() {
    return {
      selectTab: "清单",
      activeName: "/main-list",
    };
  },
  created() {
    this.init();
  },
  methods: {
    init() {
      console.log("初始化主页面");
    },
    ...mapActions(["add"]),
    handleClick(tab, event) {
      console.log(tab, event);
      // this.$router.push({ path: tab.name });
      this.selectTab = tab.label;
    }
  },
};
</script>

<style scoped>
/* .el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 20px;
  height: 20px;
}

.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 200px;
  height: 100vh;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
} 
*/

.el-main .el-tabs {
  height: calc(100vh - 82px);
}

/* body > .el-container {
  height: calc(100vh - 40px);
} */

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>